import CommonHeader from '@/components/common-header/index'
import SelectSalary from '@/apis/SelectSalary'
export default {
  name: 'DataDisplay',
  components: {
    CommonHeader,
  },
  data() {
    return {
      popTitle: '',
      date: '',
      salaryInfo: [
        {
          id: 1,
          label: '姓名',
          value: this.$store.state.userInfo.name,
        },
        {
          id: 2,
          label: '工号',
          value: '',
        },
        {
          id: 3,
          label: '基本工资',
          value: '',
        },
        {
          id: 4,
          label: '税前工资',
          value: '',
        },
        {
          id: 5,
          label: '公积金缴费',
          value: '',
        },
        {
          id: 6,
          label: '五险缴费',
          value: '',
        },
        {
          id: 7,
          label: '税费总额',
          value: '',
        },
        {
          id: 8,
          label: '应发工资',
          value: '',
        },
        {
          id: 9,
          label: '实发工资',
          value: '',
        },
      ],
    }
  },
  onLoad(options) {
    this.date = options.date
    // console.log(options.date)
  },
  mounted() {
    SelectSalary(
      {
        date: this.date,
        jobNumber: this.$store.state.userInfo.jobNumber,
      },
      this.$store.state.authorization
    ).then((res) => {
      // console.log(res)
      this.salaryInfo[1].value = res.data.data[0].jobNumber
      this.salaryInfo[2].value = res.data.data[0].basicSalary
      this.salaryInfo[3].value = res.data.data[0].grossPay
      this.salaryInfo[4].value = res.data.data[0].accumulationFund
      this.salaryInfo[5].value = res.data.data[0].fiveRiskMoney
      this.salaryInfo[6].value = res.data.data[0].personTax
      this.salaryInfo[7].value = res.data.data[0].payableAmount
      this.salaryInfo[8].value = res.data.data[0].paidAmount
    })
    this.popTitle = this.date.split('-')[0] + '年' + this.date.split('-')[1] + '月'
  },
}
